import Vue from "vue";
import VueRouter from "vue-router";
import Layout from "../layout";

Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    component: Layout,
    redirect: "/work",
    children: [
      {
        // 工作台
        path: "/work",
        component: () => import("../views/Workbench/index.vue"),
        meta: {
          title: "工作台",
        },
      },
      {
        // 商品管理
        path: "/commodity",
        component: () =>
          import("../views/Commodity/CommodityManagement/index.vue"),
        meta: {
          title: "商品管理",
        },
      },
      {
        // 商品分类
        path: "/classification",
        component: () =>
          import("../views/Commodity//CommodityClassification/index.vue"),
        meta: {
          title: "商品分类",
        },
      },
      {
        // 商品规格
        path: "/specifications",
        component: () =>
          import("../views/Commodity/CommoditySpecifications/index.vue"),
        meta: {
          title: "商品规格",
        },
      },
      {
        // 商品评价
        path: "/evaluation",
        component: () =>
          import("../views/Commodity/CommodityEvaluation/index.vue"),
        meta: {
          title: "商品评价",
        },
      },
      {
        // 秒杀配置
        path: "/configuration",
        component: () =>
          import(
            "../views/Marketing/SecondKillManagement/SecondKillConfiguration/index.vue"
          ),
        meta: {
          title: "秒杀配置",
        },
      },
      {
        // 秒杀商品
        path: "/killcommodity",
        component: () =>
          import(
            "../views/Marketing/SecondKillManagement/SecondKillCommodity/index.vue"
          ),
        meta: {
          title: "秒杀商品",
        },
      },
      {
        // 砍价商品
        path: "/bargaingoods",
        component: () =>
          import(
            "../views/Marketing/BargainingManagement/BargainGoods/index.vue"
          ),
        meta: {
          title: "砍价商品",
        },
      },
      {
        // 砍价列表
        path: "/bargainglist",
        component: () =>
          import(
            "../views/Marketing/BargainingManagement/BargainingList/index.vue"
          ),
        meta: {
          title: "砍价列表",
        },
      },
      {
        // 直播列表
        path: "/LiveList",
        component: () =>
          import(
            "../views/Marketing/LiveBroadcastManagement/LiveList/index.vue"
          ),
        meta: {
          title: "直播列表",
        },
      },
      {
        // 创建直播
        path: "/CreateLiveBroadcast",
        component: () =>
          import(
            "../views/Marketing/LiveBroadcastManagement/CreateLiveBroadcast/index.vue"
          ),
        meta: {
          title: "创建直播",
        },
      },
      {
        // 拼团商品
        path: "/GroupGoods",
        component: () =>
          import("../views/Marketing/GroupManagement/GroupGoods/index.vue"),
        meta: {
          title: "拼团商品",
        },
      },
      {
        //拼团列表
        path: "/PuzzleList",
        component: () =>
          import("../views/Marketing/GroupManagement/PuzzleList/index.vue"),
        meta: {
          title: "拼团列表",
        },
      },
      {
        //订单管理
        path: "/OrderManagement",
        component: () => import("../views/Order/OrderManagement/index.vue"),
        meta: {
          title: "订单管理",
        },
      },
      {
        //订单概述
        path: "/OrderOverview",
        component: () => import("../views/Order/OrderOverview/index.vue"),
        meta: {
          title: "订单概述",
        },
      },
      {
        //评价管理
        path: "/EvaluationManagement",
        component: () =>
          import("../views/Order/EvaluationManagement/index.vue"),
        meta: {
          title: "评价管理",
        },
      },
      {
        //订单配送
        path: "/OrderDelivery",
        component: () => import("../views/Order/OrderDelivery/index.vue"),
        meta: {
          title: "订单配送",
        },
      },
      {
        //团长管理
        path: "/HeadManagement",
        component: () => import("../views/Head/HeadManagement/index.vue"),
        meta: {
          title: "团长管理",
        },
      },
      {
        //团长审核
        path: "/HeadReview",
        component: () => import("../views/Head/HeadReview/index.vue"),
        meta: {
          title: "团长审核",
        },
      },
      {
        //团长等级
        path: "/HeadLevel",
        component: () => import("../views/Head/HeadLevel/index.vue"),
        meta: {
          title: "团长等级",
        },
      },
      {
        //设置
        path: "/SetUp",
        component: () => import("../views/Distribution/SetUp/index.vue"),
        meta: {
          title: "设置",
        },
      },
      {
        //路线
        path: "/Rout",
        component: () => import("../views/Head/Rout/index.vue"),
        meta: {
          title: "路线",
        },
      },
      {
        //佣金流水
        path: "/CommissionFlow",
        component: () => import("../views/Head/CommissionFlow/index.vue"),
        meta: {
          title: "佣金流水",
        },
      },
      {
        //申请列表
        path: "/ApplicationList",
        component: () => import("../views/store/ApplicationList/index.vue"),
        meta: {
          title: "申请列表",
        },
      },
      {
        //配置
        path: "/ToConfigure",
        component: () => import("../views/store/ToConfigure/index.vue"),
        meta: {
          title: "配置",
        },
      },
      {
        //门店
        path: "/Salesroom",
        component: () => import("../views/store/Salesroom/index.vue"),
        meta: {
          title: "门店",
        },
      },
      {
        //商品
        path: "/Wares",
        component: () => import("../views/store/Wares/index.vue"),
        meta: {
          title: "商品",
        },
      },
      {
        //订单
        path: "/OrderForm",
        component: () => import("../views/store/OrderForm/index.vue"),
        meta: {
          title: "订单",
        },
      },
      {
        //提现
        path: "/Withdrawal",
        component: () => import("../views/store/Withdrawal/index.vue"),
        meta: {
          title: "提现",
        },
      },
      {
        //到店付款
        path: "/ShopPayment",
        component: () => import("../views/store/ShopPayment/index.vue"),
        meta: {
          title: "到店付款",
        },
      },
      {
        //仓库管理
        path: "/WarehouseManagement",
        component: () =>
          import("../views/Warehouse/WarehouseManagement/index.vue"),
        meta: {
          title: "仓库管理",
        },
      },
      {
        //配送小区
        path: "/DistributionCommunity",
        component: () =>
          import("../views/Warehouse/DistributionCommunity/index.vue"),
        meta: {
          title: "配送小区",
        },
      },
      {
        //入库管理
        path: "/WarehousingManagement",
        component: () =>
          import("../views/Warehouse/WarehousingManagement/index.vue"),
        meta: {
          title: "入库管理",
        },
      },
      {
        //入库查询
        path: "/ReceiptQuery",
        component: () => import("../views/Warehouse/ReceiptQuery/index.vue"),
        meta: {
          title: "入库查询",
        },
      },
      {
        //出库管理
        path: "/OutboundManagement",
        component: () =>
          import("../views/Warehouse/OutboundManagement/index.vue"),
        meta: {
          title: "出库管理",
        },
      },
      {
        //出库查询
        path: "/IssueQuery",
        component: () => import("../views/Warehouse/IssueQuery/index.vue"),
        meta: {
          title: "出库查询",
        },
      },
      {
        //盘点管理
        path: "/InventoryManagement",
        component: () =>
          import("../views/Warehouse/InventoryManagement/index.vue"),
        meta: {
          title: "盘点管理",
        },
      },
      {
        //现有库存
        path: "/OnHandInventory",
        component: () => import("../views/Warehouse/OnHandInventory/index.vue"),
        meta: {
          title: "现有库存",
        },
      },
      {
        //超级会员
        path: "/SuperMember",
        component: () => import("../views/Distribution/SuperMember/index.vue"),
        meta: {
          title: "超级会员",
        },
      },
      {
        //代理商
        path: "/Agent",
        component: () => import("../views/Distribution/Agent/index.vue"),
        meta: {
          title: "代理商",
        },
      },
      {
        //运营商
        path: "/Operator",
        component: () => import("../views/Distribution/Operator/index.vue"),
        meta: {
          title: "运营商",
        },
      },
      {
        //佣金记录
        path: "/CommissionRecord",
        component: () =>
          import("../views/Distribution/CommissionRecord/index.vue"),
        meta: {
          title: "佣金记录",
        },
      },
      {
        //会员审核
        path: "/MemberReview",
        component: () => import("../views/Distribution/MemberReview/index.vue"),
        meta: {
          title: "会员审核",
        },
      },
      {
        //设置
        path: "/SetUp",
        component: () => import("../views/Distribution/SetUp/index.vue"),
        meta: {
          title: "设置",
        },
      },
      {
        //支付
        path: "/Payment",
        component: () => import("../views/Payment/index.vue"),
        meta: {
          title: "支付",
        },
      },
      {
        //员工管理
        path: "/EmployeeManagement",
        component: () =>
          import("../views/Jurisdiction/EmployeeManagement/index.vue"),
        meta: {
          title: "员工管理",
        },
      },
      {
        //角色管理
        path: "/RoleManagement",
        component: () =>
          import("../views/Jurisdiction/RoleManagement/index.vue"),
        meta: {
          title: "角色管理",
        },
      },
      {
        //客服管理
        path: "/CustomerServiceManagement",
        component: () =>
          import("../views/Jurisdiction/CustomerServiceManagement/index.vue"),
        meta: {
          title: "客服管理",
        },
      },
    ],
  },
];

const router = new VueRouter({
  mode: "history",
  base: process.env.BASE_URL,
  routes,
});

const originalPush = VueRouter.prototype.push;
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch((err) => err);
};

export default router;
